package com.longxi.tianjintianbao.ui.activity.equipment;

import android.support.v7.widget.RecyclerView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.equipment.EquipmentListDetailsAtPresenter;
import com.longxi.tianjintianbao.ui.view.equipment.IEquipmentListDetailsAtView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;

public class EquipmentListDetailsActivity extends BaseActivity<IEquipmentListDetailsAtView, EquipmentListDetailsAtPresenter> implements IEquipmentListDetailsAtView {

    private final String TAG = "EquipmentListDetailsActivity";
    private String state = "";
    private int page = 0;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_general_refresh_list;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
        mPresenter.initAdapter();

    }

    @Override
    public void initListener() {
        super.initListener();
        mRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {

            @Override
            public void onLoadMore(RefreshLayout refreshLayout) {
                page++;
                mPresenter.getEquipmentListDetails(page);
            }

            @Override
            public void onRefresh(RefreshLayout refreshLayout) {
                mPresenter.getEquipmentListDetails(page = 0);
            }

        });
        mPresenter.getEquipmentListDetails(page = 0);
//        mPresenter.getData();
    }

    @Override
    protected EquipmentListDetailsAtPresenter createPresenter() {
        return new EquipmentListDetailsAtPresenter(this);
    }

    @Override
    public SmartRefreshLayout getRefreshLayout() {
        return mRefreshLayout;
    }

    @Override
    public RecyclerView getRvContent() {
        return mRvContent;
    }

}
